package cz.semjob.learning.classifier.benchmark;

import java.io.Serializable;

class ClassifierBenchmarkResult implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1769626210971788432L;
	protected String documentName;
	protected double precision;
	protected double recall;
	protected double trueNegativeRate;
	protected double accuracy;

	public ClassifierBenchmarkResult() {
		super();
	}

	public ClassifierBenchmarkResult(double precision, double recall,
			double trueNegativeRate, double accuracy) {
		super();
		this.precision = precision;
		this.recall = recall;
		this.trueNegativeRate = trueNegativeRate;
		this.accuracy = accuracy;
	}

	public ClassifierBenchmarkResult(String documentName, double precision,
			double recall, double trueNegativeRate, double accuracy) {
		super();
		this.documentName = documentName;
		this.precision = precision;
		this.recall = recall;
		this.trueNegativeRate = trueNegativeRate;
		this.accuracy = accuracy;
	}

	public String getDocumentName() {
		return documentName;
	}

	public void setDocumentName(String documentName) {
		this.documentName = documentName;
	}

	public double getPrecision() {
		return precision;
	}

	public void setPrecision(double precision) {
		this.precision = precision;
	}

	public double getRecall() {
		return recall;
	}

	public double getFMeasure() {

		return (2 * precision * recall) / (precision + recall);
	}

	public void setRecall(double recall) {
		this.recall = recall;
	}

	public double getTrueNegativeRate() {
		return trueNegativeRate;
	}

	public void setTrueNegativeRate(double trueNegativeRate) {
		this.trueNegativeRate = trueNegativeRate;
	}

	public double getAccuracy() {
		return accuracy;
	}

	public void setAccuracy(double accuracy) {
		this.accuracy = accuracy;
	}

	@Override
	public String toString() {
		return "ClassifierBenchmarkResult"
				+ (documentName == null ? "" : "(" + documentName + ")")
				+ " [precision=" + precision + ", recall=" + recall
				+ ", trueNegativeRate=" + trueNegativeRate + ", accuracy="
				+ accuracy + "]\n";
	}

}
